#ifndef SERVER_HPP
#define SERVER_HPP

#include <QObject>
#include <QString>
#include <QStringList>
#include <QList>
#include <QFile>
#include <QtNetwork/QSslSocket>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QSslKey>
#include "packagemanager.hpp"

// TCP server with ssl socket
class Server : public QTcpServer
{
	Q_OBJECT

	protected :
		QSslSocket *serverSocket;
		
		QString privateKey;
		QString localCertificate;
		
		QMap<QSslSocket*,int> *connectedClients; // id of connected clients

		virtual void display(QString);
		

	public:
		Server();
		Server(quint16); // Port
		~Server();

		void start(QHostAddress, quint16);
		// Method calls by the TCP server when a new connection is coming
		void incomingConnection(int);

	public slots :
		void read(); // Calls when server is ready to read
		void disconnected();
};

#endif // SERVER_HPP
